package com.itheima.demo;

import com.itheima.demo.cofing.SpringConfig;
import com.itheima.demo.entity.User;
import com.itheima.demo.service.UserService;
import com.itheima.demo.service.impl.UserServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Date;

public class app {
    public static void main(String[] args) {
        ApplicationContext applicationContext=
                new AnnotationConfigApplicationContext(SpringConfig.class);
//        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("Spring/ApplicationContext   ----.xml");
        UserService userService = applicationContext.getBean(UserService.class);
//       UserServiceImpl userService = (UserServiceImpl) applicationContext.getBean("userService");
        User user = new User();
        user.setName("李66“？；");
        user.setPassword("123");
        user.setAge(21);
        user.setEmail("323");
        user.setPhone("323");
        user.setCreateTime(new Date());
        user.setUpdateTime(new Date());
        user.setSex("woman");
        userService.save(user);
        System.out.println(1);
    }
}
